home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility1 / gs261src.zip / STATE.H < prev    next >
C/C++ Source or Header  |  1993-05-13  |  4KB  |  108 lines

  1. /* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.  
  3. This file is part of Ghostscript.
  4.  
  5. Ghostscript is distributed in the hope that it will be useful, but
  6. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  7. to anyone for the consequences of using it or for whether it serves any
  8. particular purpose or works at all, unless he says so in writing.  Refer
  9. to the Ghostscript General Public License for full details.
  10.  
  11. Everyone is granted permission to copy, modify and redistribute
  12. Ghostscript, but only under the conditions described in the Ghostscript
  13. General Public License.  A copy of this license is supposed to have been
  14. given to you along with Ghostscript so you can know your rights and
  15. responsibilities.  It should be in a file named COPYING.  Among other
  16. things, the copyright notice and this notice must be preserved on all
  17. copies.  */
  18.  
  19. /* state.h */
  20. /* Ghostscript interpreter graphics state definition */
  21.  
  22. /* Note that from the interpreter's point of view, */
  23. /* the graphics state is opaque, i.e. the interpreter is */
  24. /* just another client of the library. */
  25.  
  26. /* The interpreter requires additional items in the graphics state. */
  27. /* These are "client data" from the library's point of view. */
  28. /* Note that they are all refs. */
  29.  
  30. typedef struct int_gstate_s int_gstate;
  31.  
  32. /* Most of the complexity in the interpreter state comes from */
  33. /* the parameters associated with the various Level 2 color spaces. */
  34.  
  35. /* CIE transformation procedures */
  36. typedef struct ref_cie_procs_s {
  37.     union {
  38.         ref ABC;
  39.         ref A;
  40.     } Decode;
  41.     ref DecodeLMN;
  42. } ref_cie_procs;
  43. /* CIE rendering transformation procedures */
  44. typedef struct ref_cie_render_procs_s {
  45.     ref TransformPQR, EncodeLMN, EncodeABC, RenderTableT;
  46. } ref_cie_render_procs;
  47.  
  48. /* Separation name and tint transform */
  49. typedef struct ref_separation_params_s {
  50.     ref layer_name, tint_transform;
  51. } ref_separation_params;
  52.  
  53. /* All color space parameters. */
  54. /* All of these are optional. */
  55. /* Note that they may actually be the parameters for an underlying or */
  56. /* alternate space for a special space. */
  57. typedef struct ref_color_procs_s {
  58.     ref_cie_procs cie;
  59.     union {
  60.         ref_separation_params separation;
  61.         ref index_proc;
  62.     } special;
  63. } ref_color_procs;
  64. typedef struct ref_colorspace_s {
  65.     ref array;        /* color space (array), */
  66.         /* only relevant if the current */
  67.         /* color space has parameters associated with it. */
  68.     ref_color_procs procs;    /* associated procedures/parameters, */
  69.         /* only relevant for CIE, Separation, Indexed/CIE, */
  70.         /* or a Pattern with one of the above */
  71. } ref_colorspace;
  72.  
  73. struct int_gstate_s {
  74.         /* Screen_procs are only relevant if setscreen was */
  75.         /* executed more recently than sethalftone */
  76.         /* (for this graphics context). */
  77.     struct {
  78.         ref red, green, blue, gray;
  79.     } screen_procs,            /* halftone screen procedures */
  80.       transfer_procs;        /* transfer procedures */
  81.     ref black_generation;        /* (procedure) */
  82.     ref undercolor_removal;        /* (procedure) */
  83.     ref font;            /* font object (dictionary) */
  84.     ref_colorspace colorspace;
  85.         /* Pattern is only relevant if the current color space */
  86.         /* is a pattern space. */
  87.     ref pattern;            /* pattern (dictionary) */
  88.     struct {
  89.         ref dict;        /* CIE color rendering dictionary */
  90.         ref_cie_render_procs procs;    /* (see above) */
  91.     } colorrendering;
  92.         /* Halftone is only relevant if sethalftone was executed */
  93.         /* more recently than setscreen for this graphics context. */
  94.         /* setscreen sets it to null. */
  95.     ref halftone;            /* halftone (dictionary) */
  96. };
  97. /* Enumerate the refs in an int_gstate. */
  98. /* Since all the elements of an int_gstate are refs, this is simple. */
  99. #define int_gstate_map_refs(p,m)\
  100.  { register ref *rp_ = (ref *)(p);\
  101.    register int i = sizeof(int_gstate) / sizeof(ref);\
  102.    do { m(rp_); ++rp_; } while ( --i );\
  103.  }
  104.  
  105. /* The current instances. */
  106. extern int_gstate istate;
  107. extern gs_state *igs;
  108.